<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
  	<meta http-equiv="X-UA-Compatible" content="IE=edge">
  	<title>用户登录</title>
  	<meta name="description" content="这是一个 index 页面">
  	<meta name="keywords" content="index">
  	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="icon" type="image/png" th:href="@{/assets/i/favicon.png}">
	<link rel="apple-touch-icon-precomposed" th:href="@{/assets/i/app-icon72x72.png}">
	<meta name="apple-mobile-web-app-title" content="Amaze UI" />
	<link rel="stylesheet" th:href="@{/assets/css/amazeui.min.css}" />
  	<link rel="stylesheet" th:href="@{/assets/css/admin.css}">
  	<link rel="stylesheet" th:href="@{/assets/css/app.css}">
	<script th:src="@{/assets/js/jquery.min.js}"></script>
	<script th:src="@{/assets/js/amazeui.min.js}"></script>
</head>

<body data-type="login">
  <div class="am-g myapp-login">
	<div class="myapp-login-logo-block  tpl-login-max">
		<div class="myapp-login-logo-text">
			<div class="myapp-login-logo-text">
				Amaze UI<span> Login</span> <i class="am-icon-skyatlas"></i>
				
			</div>
		</div>

		<div class="login-font">
			<i>Log In </i> or <span> Sign Up</span>
		</div>
		<div class="am-u-sm-10 login-am-center">
			<form class="am-form">
				<fieldset>
					<div class="am-form-group">
						<input type="text" id="name" placeholder="输入用户名"><span id="span"></span>
					</div>
					<div class="am-form-group">
						<input type="password" id="password" placeholder="输入密码" >
					</div>
					<div class="am-form-group" style="color: white"><br>
						<span>记住密码：</span>
						<input type="checkbox" id="checkbox">
					</div>
					<p>
						<button type="button" class="am-btn am-btn-default" style="margin-bottom: 20px" onclick="login()">登录</button>
						<button type="button" class="am-btn am-btn-default" onclick="register()">注册</button>
					</p>
				</fieldset>
			</form>
		</div>
	</div>
</div>

<script>
	function login() {
		var uname = $('#name').val();
		var upassword = $('#password').val();
		var param = {"username":uname,"password":upassword};
		$.post("/login",param,function (data) {
			if(data==="error"){
				$('#span').html("<span style='color: red'>用户名或密码错误</span>")
			}else {
				window.location.href="/index";
			}
		})
	}

	function register() {
		window.location.href='/goregister'
	}

</script>
</body>

</html>